{literal}
<script>
function validate(frm){
	if(!frm) frm = document.mainform;
{/literal}
{foreach from=$form._desc key=key item=list name=row}
	{assign var="name" value=$list.name|nvl:$key|d}
	{if $list.req==1 && $key!='id'}if(!checkRequire(frm.{$key}, '{$name}')) return false;{/if}
	{if $list.type=='date'}if(!checkDate(frm.{$key}, '{$name}')) return false;{/if}
{/foreach}
{literal}
	return true;
}
</script>
{/literal}